package com.cjh.springcloud.controller;

import com.cjh.springcloud.pojo.Emp;
import com.cjh.springcloud.service.EmpClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

/**
 * @Author cjh
 * @Date 2020/12/3 17:53
 * @Version 1.0
 */
@RestController

public class EmpConsumerController {

    @Autowired
    private EmpClientService empClientService;

    @GetMapping("/provider/queryOne/{empId}")
    public Emp get(@PathVariable("empId") Integer empId) {

        return empClientService.getById(empId);
    }

    @GetMapping("/provider/queryAll")
    public List<Emp> get() {

        return empClientService.getAll();
    }
}
